class Queue(object):
    def __init__(self):
        """
        initialize your data structure here.
        """
        self.a = []
        self.b = []

    def push(self, x):
        """
        :type x: int
        :rtype: nothing
        """
        self.b.append(x)

    def pop(self):
        """
        :rtype: nothing
        """
        if self.empty(): return
        val = self.a[-1]
        self.a.pop()
        return val

    def peek(self):
        """
        :rtype: int
        """
        if self.empty(): return
        return self.a[-1]

    def empty(self):
        """
        :rtype: bool
        """
        if not self.a:
            while self.b:
                self.a.append(self.b[-1])
                self.b.pop()
        return len(self.a)==0